/**
 * 用于存放 用户 tabBar
 */
import { defineStore } from 'pinia';

export const useTabBarListStore = defineStore('tabBarList', {
	state: () => ({
		tabBarList: []
	}),
	getters: {
		getTabBarList: async (state) => {
			return state.tabBarList ? state.tabBarList : await uni.getStorage({ key: "tabBarList" })
		}
	},
	actions: {
		setTabBarList: (list) => {
			const _this = useTabBarListStore()
			_this.$state.tabBarList = list
			uni.setStorage({ key: "tabBarList", data: list })
		},
		remove: () => {
			const _this = useTabBarListStore()
			_this.$state.tabBarList.splice(0, 1)
		}
	},
	persist: true
});